package frameworks.business
{
	import frameworks.widgets.BaseStackItem;
	import frameworks.widgets.Result;

	public class RequestItem extends BaseStackItem
	{
		private var _connect:RequestConnect;
		private var _method:String;
		private var _label:String;
		private var _arguments:Array;
		private var _result:Class;
		private var _modal:Boolean;
		
		public function RequestItem(label:String,connect:RequestConnect,method:String,arguments:Array,result:Class,modal:Boolean=true)
		{
			super();
			_label = label;
			_connect = connect;
			_method = method;
			_arguments = arguments;
			_result = result;
			_modal = modal;
		}
		
		public function get label():String{return _label;}
		public function get method():String{return _method;}
		public function get arguments():Array{return _arguments;}
		public function get result():Class{return _result;}
		public function get modal():Boolean{return _modal;}
		
		override public function execute():void{
			_connect.request = this;
		}
		override public function setErrorData(result:Result=null):void{
			if(_errorCallBack.length == 0){
				addErrorCallback(Util.GlobalErrorCallback);
			}
			super.setErrorData(result);
		}
	}
}